package com.xbongbong.paas.factory.subform;

import com.xbongbong.paas.enums.IndexTypeEnum;
import com.xbongbong.paas.help.subform.BomTeamTransferSubForm;
import com.xbongbong.paas.help.subform.ClueTeamTransferSubForm;
import com.xbongbong.paas.help.subform.CommunicatePlanTeamTransferSubForm;
import com.xbongbong.paas.help.subform.CompetitorTeamTransferSubForm;
import com.xbongbong.paas.help.subform.ContactTeamTransferSubForm;
import com.xbongbong.paas.help.subform.ContractPerformanceTransferSubForm;
import com.xbongbong.paas.help.subform.ContractProductTransferSubForm;
import com.xbongbong.paas.help.subform.ContractTeamTransferSubForm;
import com.xbongbong.paas.help.subform.CustomerTeamTransferSubForm;
import com.xbongbong.paas.help.subform.DefaultUserTeamTransferSubForm;
import com.xbongbong.paas.help.subform.DistributorAccountTransferSubForm;
import com.xbongbong.paas.help.subform.MarketActivityTeamTransferSubForm;
import com.xbongbong.paas.help.subform.OpportunityTeamTransferSubForm;
import com.xbongbong.paas.help.subform.PaasTeamTransferSubForm;
import com.xbongbong.paas.help.subform.PayBalanceTeamTransferSubForm;
import com.xbongbong.paas.help.subform.PayPlanSheetTeamTransferSubForm;
import com.xbongbong.paas.help.subform.PayPlanTeamTransferSubForm;
import com.xbongbong.paas.help.subform.PaymentBalanceTeamTransferSubForm;
import com.xbongbong.paas.help.subform.PaymentSheetTeamTransferSubForm;
import com.xbongbong.paas.help.subform.PaymentTaskTeamTransferSubForm;
import com.xbongbong.paas.help.subform.PaymentTeamTransferSubForm;
import com.xbongbong.paas.help.subform.ProductStockTransferSubForm;
import com.xbongbong.paas.help.subform.ProductTeamTransferSubForm;
import com.xbongbong.paas.help.subform.ProductWarehouseTransferSubForm;
import com.xbongbong.paas.help.subform.ProductionOrderTeamTransferSubForm;
import com.xbongbong.paas.help.subform.PurchaseTeamTransferSubForm;
import com.xbongbong.paas.help.subform.QuotationTeamTransferSubForm;
import com.xbongbong.paas.help.subform.RefundTeamTransferSubForm;
import com.xbongbong.paas.help.subform.SupplierContactTeamTransferSubForm;
import com.xbongbong.paas.help.subform.SupplierTeamTransferSubForm;
import com.xbongbong.paas.help.subform.WorkOrderCcTeamTransferSubForm;
import com.xbongbong.paas.help.subform.WorkOrderTeamTransferSubForm;
import com.xbongbong.paas.help.subform.abstracts.AbstractTransferSubForm;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 子表单数据库和es格式互转用工厂
 * @author 魏荣杰
 * @date 2020/8/20 16:06
 */
@Component
public class SubFormFactory {

    @Resource
    private CustomerTeamTransferSubForm customerTeamTransferSubForm;
    @Resource
    private ContractTeamTransferSubForm contractTeamTransferSubForm;
    @Resource
    private QuotationTeamTransferSubForm quotationTeamTransferSubForm;
    @Resource
    private ContactTeamTransferSubForm contactTeamTransferSubForm;
    @Resource
    private PaymentTeamTransferSubForm paymentTeamTransferSubForm;
    @Resource
    private PaymentSheetTeamTransferSubForm paymentSheetTeamTransferSubForm;
    @Resource
    private ProductionOrderTeamTransferSubForm productionOrderTeamTransferSubForm;
    @Resource
    private PayPlanTeamTransferSubForm payPlanTeamTransferSubForm;
    @Resource
    private PayPlanSheetTeamTransferSubForm payPlanSheetTeamTransferSubForm;
    @Resource
    private CommunicatePlanTeamTransferSubForm communicatePlanTeamTransferSubForm;
    @Resource
    private OpportunityTeamTransferSubForm opportunityTeamTransferSubForm;
    @Resource
    private BomTeamTransferSubForm bomTeamTransferSubForm;
    @Resource
    private PurchaseTeamTransferSubForm purchaseTeamTransferSubForm;
    @Resource
    private SupplierContactTeamTransferSubForm supplierContactTeamTransferSubForm;
    @Resource
    private SupplierTeamTransferSubForm supplierTeamTransferSubForm;
    @Resource
    private ProductTeamTransferSubForm productTeamTransferSubForm;
    @Resource
    private RefundTeamTransferSubForm refundTeamTransferSubForm;
    @Resource
    private WorkOrderTeamTransferSubForm workOrderTeamTransferSubForm;
    @Resource
    private WorkOrderCcTeamTransferSubForm workOrderCcTeamTransferSubForm;
    @Resource
    private PaymentBalanceTeamTransferSubForm paymentBalanceTeamTransferSubForm;
    @Resource
    private PayBalanceTeamTransferSubForm payBalanceTeamTransferSubForm;
    @Resource
    private ContractProductTransferSubForm contractProductTransferSubForm;
    @Resource
    private ContractPerformanceTransferSubForm contractPerformanceTransferSubForm;
    @Resource
    private ProductWarehouseTransferSubForm productWarehouseTransferSubForm;
    @Resource
    private ProductStockTransferSubForm productStockTransferSubForm;
    @Resource
    private PaymentTaskTeamTransferSubForm paymentTaskTeamTransferSubForm;
    @Resource
    private DistributorAccountTransferSubForm distributorAccountTransferSubForm;
    @Resource
    private MarketActivityTeamTransferSubForm marketActivityTeamTransferSubForm;
    @Resource
    private ClueTeamTransferSubForm clueTeamTransferSubForm;
    @Resource
    private PaasTeamTransferSubForm paasTeamTransferSubForm;
    @Resource
    private CompetitorTeamTransferSubForm competitorTeamTransferSubForm;

    /**
     * Description: 创建转化类
     * @param indexTypeEnum  es索引枚举
     * @see com.xbongbong.paas.enums.IndexTypeEnum
     * @return com.xbongbong.paas.help.subform.abstracts.AbstractTransferSubForm
     * @author 魏荣杰
     * @date 2020/8/20 16:29
     */
    public AbstractTransferSubForm createTransfer(IndexTypeEnum indexTypeEnum) {
        AbstractTransferSubForm transferSubForm = null;
        switch (indexTypeEnum) {
            case IDX_SAAS_CUSTOMER_TEAM:
            case IDX_SAAS_CUSTOMER_TEAM_SPECIAL:
                transferSubForm = customerTeamTransferSubForm;
                break;
            case IDX_SAAS_CONTRACT_TEAM:
                transferSubForm = contractTeamTransferSubForm;
                break;
            case IDX_SAAS_QUOTATION_TEAM:
                transferSubForm = quotationTeamTransferSubForm;
                break;
            case IDX_SAAS_CONTACT_TEAM:
                transferSubForm = contactTeamTransferSubForm;
                break;
            case IDX_SAAS_PAYMENT_TEAM:
                transferSubForm = paymentTeamTransferSubForm;
                break;
            case IDX_SAAS_PAYMENT_TASK_TEAM:
                transferSubForm = paymentTaskTeamTransferSubForm;
                break;
            case IDX_SAAS_PAYMENT_SHEET_TEAM:
                transferSubForm = paymentSheetTeamTransferSubForm;
                break;
            case IDX_SAAS_PRODUCTION_ORDER_TEAM:
                transferSubForm = productionOrderTeamTransferSubForm;
                break;
            case IDX_SAAS_PAY_PLAN_TEAM:
                transferSubForm = payPlanTeamTransferSubForm;
                break;
            case IDX_SAAS_PAYPLAN_SHEET_TEAM:
                transferSubForm = payPlanSheetTeamTransferSubForm;
                break;
            case IDX_SAAS_COMMUNICATE_PLAN_TEAM:
                transferSubForm = communicatePlanTeamTransferSubForm;
                break;
            case IDX_SAAS_OPPORTUNITY_TEAM:
                transferSubForm = opportunityTeamTransferSubForm;
                break;
            case IDX_SAAS_BOM_TEAM:
                transferSubForm = bomTeamTransferSubForm;
                break;
            case IDX_SAAS_PURCHASE_TEAM:
                transferSubForm = purchaseTeamTransferSubForm;
                break;
            case IDX_SAAS_SUPPLIER_CONTACT_TEAM:
                transferSubForm = supplierContactTeamTransferSubForm;
                break;
            case IDX_SAAS_SUPPLIER_TEAM:
                transferSubForm = supplierTeamTransferSubForm;
                break;
            case IDX_SAAS_PRODUCT_TEAM:
                transferSubForm = productTeamTransferSubForm;
                break;
            case IDX_SAAS_REFUND_TEAM:
                transferSubForm = refundTeamTransferSubForm;
                break;
            case IDX_SAAS_WORK_ORDER_TEAM:
                transferSubForm = workOrderTeamTransferSubForm;
                break;
            case IDX_SAAS_WORK_ORDER_CC:
                transferSubForm = workOrderCcTeamTransferSubForm;
                break;
            case IDX_PAYMENT_BALANCE_TEAM:
                transferSubForm = paymentBalanceTeamTransferSubForm;
                break;
            case IDX_PAY_BALANCE_TEAM:
                transferSubForm = payBalanceTeamTransferSubForm;
                break;
            case IDX_SAAS_CONTRACT_PRODUCT:
                transferSubForm = contractProductTransferSubForm;
                break;
            case IDX_SAAS_CONTRACT_PERFORMANCE:
                transferSubForm = contractPerformanceTransferSubForm;
                break;
            case IDX_SAAS_PRODUCT_WAREHOUSE:
                transferSubForm = productWarehouseTransferSubForm;
                break;
            case IDX_SAAS_PRODUCT_STOCK_INFO:
                transferSubForm = productStockTransferSubForm;
                break;
            case IDX_SAAS_DISTRIBUTOR_ACCOUNT:
                transferSubForm = distributorAccountTransferSubForm;
                break;
            case IDX_SAAS_MARKET_ACTIVITY_TEAM:
                transferSubForm = marketActivityTeamTransferSubForm;
                break;
            case IDX_SAAS_CLUE_TEAM:
                transferSubForm = clueTeamTransferSubForm;
                break;
            case IDX_SAAS_COMPETITOR_TEAM:
                transferSubForm = competitorTeamTransferSubForm;
                break;
            case IDX_FORM_DATA_TEAM:
                transferSubForm = paasTeamTransferSubForm;
                break;
            default:
                transferSubForm = new DefaultUserTeamTransferSubForm();
                break;
        }
        return transferSubForm;
    }
}
